<template>
	<view class="index">
		<view class="uni-list" v-if="mailList.length > 0">
			<view class="uni-list-cell" v-for="(item,index) in mailList" :key="index">
				<view class="uni-list-cell-navigate">
					<view class="info">{{item.info}}</view>
					<view class="time">{{item.create_time}}</view>
				</view>
			</view>
		</view>
		<view class="no-data" v-else>你还没有站内信息</view>
	</view>
</template>

<script>
	import Request from '../../common/request.js';
	
	export default {
		data() {
			return {
				mailList: [],
				page: 1,
				nextPage: true
			};
		},
		onLoad() {
			this.getList();
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			getList() {
				if(this.nextPage == false) {
					return ;
				}
				
				var that = this;
				var params = {
					url: 'feedback/webmail',
					data: {page: that.page},
					sCallback: function(res) {
						that.page ++ ;
						that.mailList = that.mailList.concat(res.data);
						if(res.data.length < 20) {
							that.nextPage = false;
						}
					}
				}
				
				Request.send(params);
			}
		}
	}
</script>

<style>
	
	.uni-list-cell-navigate{
		flex-direction: column;
		display: block;
	}
	.info{
		font-size: 28upx;
		
		width: 100%;
		 white-space:normal;
         word-break:break-all;
         word-wrap:break-word; 
	}
	
	.time{
		font-size: 24upx;
		justify-content: flex-end;
		width: 100%;
		text-align: right;
		color: #999
	}
</style>
